package JavaQuestions;


import java.util.*;
import java.io.*;

/**
 * TODO Put here a description of what this class does.
 *
 * @author jh238d.
 *         Created Mar 21, 2012.
 */
public class Operation {
	private String s;
	private double result = 0;
	private Stack<Double> digit = new Stack<Double>();
	private Stack<String> op = new Stack<String>();
	
	public Operation(String str)
	{
		s = str;
	}
	
	public static void main(String[] arg)
	{
		try{
			BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
			String str = buf.readLine();
			Operation ope = new Operation(str);
			System.out.println(ope.Cal());
		}
		catch(IOException e)
		{
			System.out.println("Error!");
		}
	}
	
	public double Cal()
	{
		String[] c = s.split(String.valueOf(' '));
		for(int i = 0; i < c.length; i++)
		{
			if (i == c.length - 1 && !c[i].equals(")"))
			{
				double a = digit.pop();
				String o = op.pop();
				Double r = new Double(0);
				if(o.equals("+")) r = digit.pop() + a;
				else if (o.equals("-")) r = digit.pop() - a;
				else if (o.equals("*")) r = digit.pop() * a;
				else if (o.equals("/")) r = digit.pop() / a;
				else if (o.equals("sqrt")) r = Math.sqrt(a);
				digit.push(r);
				return digit.pop();
			}
			if(c[i].equals("("));
			else if (c[i].equals("+")) op.push(c[i]);
			else if (c[i].equals("-")) op.push(c[i]);
			else if (c[i].equals("*")) op.push(c[i]);
			else if (c[i].equals("/")) op.push(c[i]);
			else if (c[i].equals("sqrt")) op.push(c[i]);
			else if (c[i].equals(")"))
			{
				double a = digit.pop();
				String o = op.pop();
				Double r = new Double(0);
				if(o.equals("+")) r = digit.pop() + a;
				else if (o.equals("-")) r = digit.pop() - a;
				else if (o.equals("*")) r = digit.pop() * a;
				else if (o.equals("/")) r = digit.pop() / a;
				else if (o.equals("+")) r = Math.sqrt(a);
				digit.push(r);
			}
			else
			{
				Double d = Double.parseDouble(c[i]);
				digit.push(d);
			}
		}
		return digit.pop();
	}
	
}
